<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>登录企业之家网网站管理系统</title>
    <meta name="description" content="企业之家网后台管理框架">
    <link rel="stylesheet" href="${global_templets_skin}/systemstyle/layui/css/layui.css" media="all">
    <link href="${global_templets_skin}/systemstyle/style/login.css" rel="stylesheet"/>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <link rel="shortcut icon" href="favicon.ico"/>
    <style type="text/css">label.error {
        position: inherit;
    }

    .layui-layer-dialog .layui-layer-content {
        color: #676a6c;
    }
    </style>
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location
        }
        ;
    </script>
</head>

<body class="signin">

<div class="signinpanel">
    <div class="row">
        <div class="layui-col-sm7 layui-hide-xs">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1><img alt="企业之家网" src="${global_templets_skin}/systemstyle/images/logo.png"></h1>
                </div>
                <div class="m-b"></div>
                <h4>欢迎使用 <strong>企业之家网 企业营销管理系统</strong></h4>
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 产品稳定、数据可靠</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 弹性伸缩、按需付费；</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 抛弃繁琐、快速建站；</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 完善的7*24小时不间断技术支持；</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 专业服务，让您省心更安心！</li>
                </ul>
                <strong>已有账号？ <a href="/member/login.do">立即登录&raquo;</a></strong>
            </div>
        </div>
        <div class="layui-col-sm5">
            <div class="layui-form" lay-filter="user-regist-form">
                <p class="regist-user-title">注册</p>
                <label>手机号</label>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-cellphone"></label>
                    <input type="text" name="userName" id="LAY-user-login-cellphone" lay-verify="required|phone" placeholder="请输入您的手机号" class="layui-input">
                </div>
                <label>手机验证码</label>
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs7">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                            <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="验证码" class="layui-input">
                        </div>
                        <div class="layui-col-xs5">
                            <div style="margin-left: 10px;">
                                <button type="button" class="layui-btn layui-btn-primary layui-btn-fluid" id="LAY-user-getsmscode">获取验证码</button>
                            </div>
                        </div>
                    </div>
                </div>
                <label>密码</label>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                    <input type="password" name="password" id="LAY-user-login-password" lay-verify="required|pass" placeholder="密码" class="layui-input">
                </div>
                <label>确认密码</label>
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
                    <input type="password" name="repass" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
                </div>

                <div class="layui-form-item" style="position: relative;margin-bottom: 5px;text-align: left; height: 32px;">
                    <input type="checkbox" name="agreement" value="1" lay-skin="primary" title="" checked="">
                    <div class="layui-unselect layui-form-checkbox layui-form-checked" lay-skin="primary">
                        <i class="layui-icon layui-icon-ok"></i>
                    </div>
                    <a href="/instructions/terms.html" target="_blank" style="position: relative; top: 5px; left: -7px; color: #999;">同意用户服务条款</a>
                </div>
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="formAddUser" id="btnSubmit"
                        data-loading="正在验证注册，请稍后...">免费注册
                </button>
            </div>
        </div>
    </div>

    <div class="signup-footer">
        <div class="layadmin-user-login-footer">
            &copy; 2019 All Rights Reserved. 企业之家网 <br>
        </div>
    </div>
</div>

<script src="${global_templets_skin}/systemstyle/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
        base: '${global_templets_skin}/systemstyle/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['layer', 'form'], function(){
        var $ = layui.$
            ,layer = layui.layer
            ,form = layui.form;

        $(document).on('click','#LAY-user-getsmscode',function(){
                layer.open({
                    type: 1,
                    btn: ['确定'],
                    title: '输入图形验证码'
                    ,content: '<div class="layui-input-block input-group">\n' +
                    '<input type="text" name="captcha" id="captcha" class="layui-input" placeholder="验证码">\n' +
                    '<div class="input-group-addon"><img id="code" src="/captcha/captcha.do" class="imgcode" onclick="reloadCode();"/></div>\n' +
                    '</div>'
                    ,yes: function(index, layero){
                        $.ajax({
                            url: '/member/sms_code.do',
                            data: {'mobile': $('#LAY-user-login-cellphone').val(),'captcha': $('#captcha').val()},
                            dataType: "json",
                            type :  "POST",
                            cache : false,
                            async: false,
                            error : function(i, g, h) {
                                layer.msg('发送错误', {icon: 2});
                            },
                            success: function(data){
                                if(data.code==0){
                                    layer.msg('验证码已发送您的手机上，请查收！', {icon: 1});
                                    layer.close(index);
                                    return false;
                                }else{
                                    layer.msg(data.message, {icon: 2});
                                    reloadCode();
                                    return false;
                                }
                            }
                        });
                        //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构', {time: 5000, icon:6});
                        return false;
                    }
                });
            });

        form.on('submit(formAddUser)', function(data) {
            $.ajax({
                url:'/member/register.do',
                type:'post',
                dataType: 'json',
                data: data.field,
                success:function(e){
                    if (e.code == "0") {
                        layer.msg(e.message, {icon: 1});
                        location.href = e.goUrl;
                    }else {
                        layer.msg(e.message, {icon: 2});
                    }
                }
            })
            //防止页面跳转
            return false;
        });
        /*$.ajax({
            url: '/member/sms_code.do',
            data: {'mobile': $('#LAY-user-login-cellphone').val(),'captcha': $('#captcha').val()},
            dataType: "json",
            type :  "POST",
            cache : false,
            async: false,
            error : function(i, g, h) {
                layer.msg('发送错误', {icon: 2});
            },
            success: function(data){
                if(data.code==0){
                    $('#myMobileModal').modal('hide');
                    layer.msg('验证码已发送您的手机上，请查收！', {icon: 1});
                    return false;
                }else{
                    layer.msg(data.message, {icon: 2});
                    new_src = '/captcha/default?'+Math.random();
                    $("#reloadCaptcha").find("img").attr("src",new_src);
                    $(".captcha").val("");
                }
            }
        });*/
       /* //登陆
        $('#btnSubmit').click(function () {
            var username = $('#username').val();
            var password = $('#password').val();
            var captcha = $('#captcha').val();
            if (username == "" || username == null) {
                layer.msg('用户名不能为空', {icon: 2});
                return false;
            } else if (password == "" || password == null) {
                layer.msg('密码不能为空', {icon: 2});
                return false;
            } else if (captcha == "" || captcha == null) {
                layer.msg('验证码不能为空', {icon: 2});
                return false;
            }
            //console.log(username);
            //debugger;
            $.ajax({
                url: "/member/login.do",
                data: {'username': username, 'password': password, 'captcha': captcha},
                type: "post",
                dataType: 'json',
                cache: false,
                async: false,
                error: function (i, g, h) {
                    layer.msg('发送错误', {icon: 2});
                },
                success: function (data) {
                    if (data.code == '0') {
                        window.location.href = "/member/index.do";
                    } else {
                        layer.msg(data.message, {icon: 2});
                    }
                },
                error: function (data) {
                    alert("出错：" + data.message);
                }
            });
        });*/
    });


    //重新加载验证码
    function reloadCode() {
        var code = document.getElementById('code');
        code.setAttribute('src', '/captcha/captcha.do?' + Math.random());
    }
</script>
</body>
</html>